package tools

import (
	"encoding/json"
	"fmt"
	"gitee.com/uni-minds/bridge-pacs/global"
)

func DecodeCachePathImage(str string) (cache global.CachePathImage) {
	if str != "" {
		err := json.Unmarshal([]byte(str), &cache)
		if err != nil {
			fmt.Println("E Decode cache:", str, err.Error())
		}
	}
	return cache
}
func EncodeCachePathImage(cache global.CachePathImage) string {
	bs, _ := json.Marshal(cache)
	return string(bs)
}
func DecodeCachePathVideo(str string) (cache global.CachePathVideo) {
	if str != "" {
		err := json.Unmarshal([]byte(str), &cache)
		if err != nil {
			fmt.Println("E Decode cache:", str, err.Error())
		}
	}
	return cache
}
func EncodeCachePathVideo(cache global.CachePathVideo) string {
	bs, _ := json.Marshal(cache)
	return string(bs)
}
